﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using System.Data;
public partial class basic_add_pub : System.Web.UI.Page
{
  
        OracleConnection con = new OracleConnection("Data Source=orcl;Persist Security Info=True;User ID=booksale;Password=Qwertyuiop1;Unicode=True");
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            string sql = "insert into booksale.Book_Pub(编号,出版社,地址,邮编,电话) values('" + publishid.Text + "','" + publishname.Text + "','" + address.Text + "','" + post.Text + "','" + tele.Text + "')";

            OracleCommand com = new OracleCommand(sql, con);

            if (con.State.Equals(ConnectionState.Closed))
            { con.Open(); }
            if (Convert.ToInt32(com.ExecuteNonQuery()) > 0)
            { Response.Write("<script language=javascript>alert('添加成功');</script>"); }
            else
            { Response.Write("<script language=javascript>alert('添加失败');</script>"); }
            if (con.State.Equals(ConnectionState.Open))
            { con.Close(); }
        }



        protected void Button2_Click(object sender, EventArgs e)
        {
            publishid.Text = publishname.Text = address.Text = post.Text = tele.Text  = " ";
        }
    }
